//web 路由 设置api相关接口

var express = require('express');
var api = express.Router();
var setting = require('../setting');



api.get('/api/login', function (req, res, next) {
    res.json({code:0, message: "success", data: {email:"123"}});
});

api.get('/api/login1', function (req, res, next) {
    throw new Error("login1 error!");
});

api.get('/api/login2', function (req, res, next) {
    throw new Error("login2 error!");
});

api.get('/api/login3', function (req, res, next) {
    throw new Error("login3 error!");
});

api.use('/api/*', function(req, res, next){
    res.json({code:400, message: "not find api!"});
});

api.use('/api/*', function(err, req, res, next){
    res.json({code:500, message: err.message});
});

module.exports = api;